﻿using System;
using System.ComponentModel.DataAnnotations;

namespace IntellectShop.Common
{
	public partial class Category
	{
		[ScaffoldColumn(false)]
		public int CategoryID { get; set; }

		[DisplayNameLocalized("CategoryName")]
		[Required(ErrorMessageResourceName = "CategoryNameIsRequired", ErrorMessageResourceType = typeof(Resources.Errors))]
		public string Name { get; set; }

		[DisplayNameLocalized("SortingID")]
		[Required(ErrorMessageResourceName = "SortingIDIsRequired", ErrorMessageResourceType = typeof(Resources.Errors))]
		public int SortingID { get; set; }

		[DisplayNameLocalized("Created")]
		public DateTime? Created { get; set; }

		[DisplayNameLocalized("CreatedBy")]
		public string CreatedBy { get; set; }

		[DisplayNameLocalized("Updated")]
		public DateTime Updated { get; set; }

		[DisplayNameLocalized("UpdatedBy")]
		public string UpdatedBy { get; set; }

		public override string ToString()
		{
			return this.Name;
		}

		public override bool Equals(object obj)
		{
			if (obj == null)
				return false;

			if (obj.GetType() != this.GetType())
				return false;

			Category other = (Category)obj;
			return this.CategoryID == other.CategoryID && this.Name == other.Name;
		}

		public override int GetHashCode()
		{
			return this.CategoryID;
		}
	}
}
